<?php
use core\Request;
use core\Response;
use core\Router;


/** @var Router $router */

$router->get('/', function(Request $request, Response $response) {
    $response->text('from /');
});

$router->get('/test', function(Request $request, Response $response) {
    $response->text('from /test');
});

$router->get('/test2', function(Request $request, Response $response) {
    $response->text('from /test2');
});

$router->get('/name/:name/age/:age', function(Request $request, Response $response) {
    $response->json($request->getParams());
});


$router->group('group', function(Router $router) {
    $router->get('', function(Request $request, Response $response) {
        $response->text('from /group');
    });

    $router->get('test', function(Request $request, Response $response) {
        $response->text('from /group/test');
    });
});
